from common.lib import Singleton
from time import strftime

class Logger(Singleton):
    
    def __init__(self):
        self.logfile = "/home/sisko/gdiv.log"
        self.file = open(self.logfile,"w")
    
    def _write(self, line):
        line = strftime("(%H:%M:%S) ") + line
        self.file.write(line + '\n')
    
    def DEBUG(self, line):
        line = 'DEBUG: ' + line
        self._write(line)

    def info(self, line):
        line = 'Info: ' + line
        self._write(line)
        
    def error(self, line):
        line = 'Error: ' + line
        self._write(line)
        
    def close(self):
        self.file.close()